﻿using Dapper;
using System;
using BCEntity.Trading.SaleGoods.SaleGoods;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Threading.Tasks;

namespace BCData.Trading.SaleGoods.SaleGoods
{
    /// <summary>
    /// 销售商品
    /// </summary>
    public interface ISaleGoodsData
    {
        #region  成员方法
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        /// <param name="saleGoodsId">销售商品Id</param>
        Task<bool> Exists(long saleGoodsId);
        /// <summary>
        /// 是否存在此分类的商品记录
        /// </summary>
        /// <param name="saleGoodsCategoryId">销售商品分类Id</param>
        Task<bool> CategoryExists(long saleGoodsCategoryId);
        /// <summary>
        /// 是否存在此商品SKU
        /// </summary>
        /// <param name="sku">SKU</param>
        /// <returns></returns>
        Task<bool> SKUExists(string sku);
        /// <summary>
        /// 增加销售商品
        /// </summary>
        /// <param name="entity">销售商品信息</param>
        Task<SaleGoodsEntity> Add(SaleGoodsEntity entity);
        /// <summary>
        /// 更新销售商品
        /// </summary>
        /// <param name="entity">销售商品信息</param>
        Task<SaleGoodsEntity> Update(SaleGoodsEntity entity);
        /// <summary>
        /// 删除销售商品
        /// </summary>
        /// <param name="saleGoodsId">销售商品Id</param>
        Task<bool> Delete(long saleGoodsId);
        /// <summary>
        /// 获取销售商品
        /// </summary>
        /// <param name="saleGoodsId">销售商品Id</param>
        Task<SaleGoodsEntity> GetEntity(long saleGoodsId);
        /// <summary>
        /// 获取销售商品
        /// </summary>
        /// <param name="sku">销售商品SKU</param>
        Task<SaleGoodsEntity> GetEntity(string sku);
        /// <summary>
        /// 获取销售商品列表
        /// </summary>
        Task<IEnumerable<SaleGoodsEntity>> GetList();
        /// <summary>
        /// 获取销售商品分页列表
        /// </summary>
        /// <param name="saleGoodsCategoryId">商品分类Id</param>
        /// <param name="categoryName">商品分类名称</param>
        /// <param name="goodsName">商品名称</param>
        /// <param name="sku">商品SKU</param>
        /// <param name="enabled">启用</param>
        /// <param name="start">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <param name="sortName">排序字段</param>
        /// <param name="ascending">升序</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页数据条数</param>
        Task<(IEnumerable<SaleGoodsEntity>, int)> Query(long? saleGoodsCategoryId, string categoryName, string goodsName, string sku, bool? enabled, DateTime? start, DateTime? end, string sortName, bool? ascending, int pageIndex, int pageSize);
        /// <summary>
        /// 启用销售商品
        /// </summary>
        /// <param name="saleGoodsId">销售商品Id</param>
        Task<bool> Enabled(long saleGoodsId);
        /// <summary>
        /// 禁用销售商品
        /// </summary>
        /// <param name="saleGoodsId">销售商品Id</param>
        Task<bool> Disabled(long saleGoodsId);
        #endregion  成员方法
    }


}